home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
436_01
/
make.bat
< prev
next >
Wrap
DOS Batch File
|
1994-10-07
|
3KB
|
95 lines
::MAKE.BAT -- requires Borland MAKE.
echo off
cls
:: Save path
set op=%path%
if "%1"=="?" goto :HELP
if not "%1"=="" goto :DOIT
:HELP
:: Set name to caps
path=%0
echo Syntax is: %path% MAKEFILE [T] [D] [M] [X [X [...]]]
echo/
echo MAKEFILE The name of the make file for MAKE.EXE to process (include
echo the extension if it is not .MAK).
echo T Runs MAKE.EXE in test mode with the -n switch (prints
echo commands but does not actually perform them).
echo D Activates compiler switches to put debugging info into
echo output files by defining DEBUG (-DDEBUG) on the MAKE.EXE
echo command line.
echo M Must be either S, M, C, or L, and defines the memory
echo model (-DMDL=M). Default is S.
echo X Is any number of additional TC command-line switches or
echo definitions, separated by at least one space.
echo/
echo MAKEFILE must be the first parameter; others may appear in any order.
echo Case is significant only in X parameters that you define in the make
echo file; %path%.BAT takes care of the rest. If more than one M occurs,
echo the last is used. Xs are concatenated (with a space for separation)
echo and passed to MAKE.EXE in an environment variable. You can't use ';'
echo to gang X parameters or use '=' to define strings, since COMMAND.COM
echo treats those characters as command line delimiters.
goto :EXIT
:DOIT
:: Default mem model
set m=s
for %%x in (%1 %1.mak) do if exist %%x goto :EXISTS
echo Can't find make file: %1
echo/
goto :HELP
:EXISTS ::save makefile name
set f=%1
:LOOP
shift
if "%1"=="" goto :MAKE ::shift parms until no more
::
for %%x in (t d s m c l T D S M C L) do if "%%x"=="%1" goto :%%x
::
:: Concat X parms, separated by space
::
set x=%x% %1
goto :LOOP
:t ::test mode
:T
set t=-n
goto :LOOP
:d ::compile w/DEBUG
:D
set d=-DDEBUG
goto :LOOP
::
::Borland's MAKE doesn't like memory model in caps (damn).
::
:s
:S
set m=s
goto :LOOP
:m
:M
set m=m
goto :LOOP
:c
:C
set m=c
goto :LOOP
:l
:L
set m=l
goto :LOOP
:MAKE
if exist c:\tc\make.exe goto :MAKE_OK
echo Can't find \TC\MAKE.EXE
goto :EXIT
:MAKE_OK
echo c:\tc\make -a -f%f% %t% %d% -DMDL=%m% %x%
c:\tc\make -a -f%f% %t% %d% -DMDL=%m% %x%
:EXIT
path=%op%
set op=
set x=
set f=
set t=
set d=
set m=